package com.ict.config;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

public class Config {
	public static String redisPasswd="";
	public static String redisIP="";
	public static int redisPort=6379;
	public static String recvMQIP="";
	public static String recvMQUserName="";
	public static String recvMQPasswd="";
	public static int  recvMQPort; 
	public static String recvVirtualHost="/";
	public static String recvExChangeName="";
	public static String sendMQIP="";
	public static String sendMQUserName="";
	public static String sendMQPasswd="";
	public static int sendMQPort;
	public static String SendVirtualHost="/";
	public static String sendExChangeName="";
	public static String origTargetRoutingKey="";
	public static String fuseTargetRoutingKey="";
	public static String [] forwardRoutingKeys= {};
	public static int listCatchSize;
	public static int timeCycle;
	
	
	
	
	
	
	private static final Logger logger=Logger.getLogger(Config.class);
	static {
		String userPath = System.getProperty("user.dir");
		Properties props = new Properties();
		InputStream in;
		try {
			in = new FileInputStream(userPath + "/config.properties");
			try {
				props.load(in);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			in.close();

		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		redisIP = props.getProperty("redisIP");
		redisPort =Integer.parseInt(props.getProperty("redisPort"));
		redisPasswd = props.getProperty("redisPasswd");
		recvMQIP=props.getProperty("recvMQIP");
	    recvMQUserName=props.getProperty("recvMQUserName");
		recvMQPasswd=props.getProperty("recvMQPasswd");
		recvMQPort=Integer.parseInt(props.getProperty("recvMQPort")); 
		recvVirtualHost=props.getProperty("recvVirtualHost");
		sendMQIP=props.getProperty("sendMQIP");
		sendMQUserName=props.getProperty("sendMQUserName");
		sendMQPasswd=props.getProperty("sendMQPasswd");
		sendMQPort=Integer.parseInt(props.getProperty("sendMQPort")); 
		SendVirtualHost=props.getProperty("SendVirtualHost");
		recvExChangeName=props.getProperty("recvExChangeName");
		sendExChangeName=props.getProperty("sendExChangeName");
		origTargetRoutingKey=props.getProperty("origTargetRoutingKey");
		fuseTargetRoutingKey=props.getProperty("fuseTargetRoutingKey");
		forwardRoutingKeys= props.getProperty("forwardRoutingKeys").split(",");
		listCatchSize =Integer.parseInt(props.getProperty("listCatchSize"));
		timeCycle =Integer.parseInt(props.getProperty("timeCycle"));
		
		
		
		
		

	}
	
	
}
